﻿using System;
using System.Collections.Generic;
using System.Text;
using ElementClasses;
using System.IO;

namespace ExDayBook
{
    public class ExClass : ExternalElement
    {

        public override string Name { get { return "ExDayBook"; } }
        public override string MenuName { get { return "Ежедневник"; } }

        #region *** данные ****************************

        List<DayNote> nl = new List<DayNote>();

        public override void ChangeSourceData(ChangeDataEvents ChangeDataEvent, byte[] NewSourceData)
        {
            using (MemoryStream ms = new MemoryStream(NewSourceData))
            {
                using (BinaryReader br = new BinaryReader(ms, Encoding.UTF8))
                {
                    br.ReadUInt32(); // задел на версионность

                    //

                }
            }
        }

        public override byte[] GetSourceData()
        {
            using (MemoryStream ms = new MemoryStream())
            {
                using (BinaryWriter bw = new BinaryWriter(ms, Encoding.UTF8))
                {
                    bw.Write(0); // задел на версионность

                   // bw.Write(sSomeData);
                    bw.Flush();
                    return ms.ToArray();
                }
            }
        }

        #endregion *** данные ****************************

        public override void Init() { ; }

        public override void NotifyMenuBotton_Click()
        {
            IsEdit = true;
            FormDayBook frm = new FormDayBook();
            frm.ShowDialog();
           /* if (frm.ShowDialog(sSomeData))
            {
                sSomeData = frm.RetVal;
                IsSaveData = true;
            }*/
            frm.Dispose();
            IsEdit = false;
        }
    }

}
